async function async1() {
  console.log('async1');
  await async2()
  console.log('async1 end')
}
async function async2() {
  console.log('async2')
}
console.log('script start')
async1()

setTimeout(function () {
  console.log('setTimeout')
}, 0)

new Promise(resolve => {
  console.log('Promise')
  resolve()
})
  .then(function () {
    console.log('promise1')
  })
  .then(function () {
    console.log('promise2')
  })

console.log('script end')
// script start
// async1
// async2
// Promise
// script end
// async1 end
// promise1
// promise2
// setTimeout

new Promise((resolve, reject) => {
  reject(1);
  console.log(7);
  // resolve()
})
  .catch((error) => {
    console.log(2)
    return error;
  })
  .then((e) => console.log(3, e), (v) => console.log(v))
  .then(console.log)
console.log(5)
// 7
// 5
// 2
// 3 1
// undefined